package com.manlost.web.controller.baby;

import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.manlost.biz.ManlostServiceLocator;
import com.manlost.biz.baby.BabyService;
import com.manlost.web.common.ManLostSession;
import com.manlost.web.common.WebUser;

@Controller
public class BabyController {
	Log log=LogFactory.getLog("BabyController");
	private BabyService babyService = ManlostServiceLocator.getBabyService();

	@RequestMapping(value="/baby",method = RequestMethod.GET)
	public String getRequest(Map<String,Object> model, @RequestParam("id")String id) {
		Long babyId=null;
		try{
			babyId=Long.valueOf(id);
			WebUser webUser = ManLostSession.getCurrent().getWebUser();
			model.put("isSigned", webUser.isSignIn());
			model.put("baby", babyService.getOneBabyById(babyId));
		}catch(Exception e){
			log.error("baby detail params error!");
		}
        return "baby/baby";
    }
}
